package com.hebang.stcommunityapp.custom;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.hebang.stcommunityapp.R;
import com.hebang.stcommunityapp.beans.CustomModel;
import com.hebang.stcommunityapp.beans.SyItemBean;
import com.hebang.stcommunityapp.databinding.SyItemBinding;

public class SyItemView extends BaseCustomLiner {
  private SyItemBean paramBean;
    private SyItemBinding binding;
    public SyItemView(Context context) {
        super(context);
        initview();
    }

    public SyItemView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initview();
    }

    private void  initview(){
       binding = DataBindingUtil.inflate(LayoutInflater.from(this.getContext()), R.layout.sy_item, this, false);
       binding.setParam(paramBean);
       addView(binding.getRoot());
   }

    public SyItemBean getParamBean(){
        return paramBean;
    }

    @Override
    public void setdata(CustomModel customModel) {
        this. paramBean=(SyItemBean)customModel;
        binding.setParam(this.paramBean);
        binding.executePendingBindings();
        binding.img.setImageResource(paramBean.getResouce());
    }
}
